#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "OLED.h"
#include "Remote.h"

uint8_t Address;
uint8_t Command;
uint8_t Num;
int main(void)
{
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
	Remote_Init(30000,72);
	OLED_Init();
	OLED_ShowString(1,1,"ADDR CMD NUM");
	OLED_ShowString(2,1,"00   00  000");
	while(1)
	{
		if (IR_GetDataFlag() || IR_GetRepeatFlag())
		{
			Address = IR_GetAddress();
			Command = IR_GetCommand();
			
			OLED_ShowHexNum(2,1,Address,2);
			OLED_ShowHexNum(2,6,Command,2);
			
			if (Command == IR_VOL_ADD)
			{
				Num++;
			}
			if(Command == IR_VOL_MINUS)
			{
				Num--;
			}
			OLED_ShowNum(2,10,Num,3);
		}
	}
}


